package com.ruoyi.web.controller.monitor;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.monitor.domain.BusWaterAutomonitorevaluateDaydata;
import com.ruoyi.monitor.service.IBusWaterAutomonitorDaydataStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/monitor/autovaluatedaydatastatistics")
public class BusWaterAutomonitorDaydataStatisticsController extends BaseController {

    @Autowired
    private IBusWaterAutomonitorDaydataStatisticsService statisticsService;

    /**
     * 水质对比分析
     * @param beginTime 开始时间
     * @param endTime 结束时间
     * @param segmentId 断面id
     *  @param itemId 断面因子 0为断面水质级别
     * @return
     *
     */
    //@PreAuthorize("@ss.hasPermi('monitor:autovaluatedaydatastatistics:list')")
    @GetMapping("/comparedata")
    public AjaxResult comparedata(String startTime, String endTime, String segmentId, String itemId) {
        Map map=new HashMap();
        map.put("startTime", startTime);
        map.put("endTime", endTime);
        map.put("itemId", itemId);
        //断面id处理
        List<String> segmentIds = null;
        if (segmentId!=null&&!"".equals(segmentId)) {
            String[] arr = segmentId.split(",");
            segmentIds = Arrays.asList(arr);
            map.put("segmentIds",segmentIds);

        }
        Map maplist = statisticsService.selectevaluateDaycomparestatisticList(map);
        return AjaxResult.success(maplist);
    }

}
